home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / tcl / xf2.3-p / xf2 / xf2.3 / src / xfelements.tcl < prev    next >
Encoding:
Text File  |  1993-11-20  |  43.5 KB  |  1,403 lines

  1. # Program: xf
  2. # Description: the elements used for configure windows
  3. #
  4. # $Header: xfelements.tcl[2.4] Wed Mar 10 12:05:47 1993 garfield@garfield frozen $
  5.  
  6. ##########
  7. # Procedure: XFElementAnchor
  8. # Description: build anchor frame
  9. # Arguments: xfW - the widget we configure
  10. #            xfRoot - the root name
  11. #            xfType - add or config
  12. #            xfClass - the class we configure
  13. #            xfFunction - the function that sets the values
  14. # Returns: none
  15. # Sideeffects: none
  16. ##########
  17. proc XFElementAnchor {xfW xfRoot xfType xfClass xfFunction} {
  18.   global xfMisc
  19.  
  20.   XFTmpltFrame $xfRoot.params1.params2.anchor 0
  21.  
  22.   label $xfRoot.params1.params2.anchor.label1 \
  23.     -text "Anchor:"
  24.  
  25.   XFTmpltFrame $xfRoot.params1.params2.anchor.anchor 0
  26.  
  27.   XFTmpltFrame $xfRoot.params1.params2.anchor.anchor.f1 0
  28.  
  29.   XFTmpltFrame $xfRoot.params1.params2.anchor.anchor.f2 0
  30.  
  31.   XFTmpltFrame $xfRoot.params1.params2.anchor.anchor.f3 0
  32.  
  33.   radiobutton $xfRoot.params1.params2.anchor.anchor.f1.nw \
  34.     -anchor w \
  35.     -text {NW} \
  36.     -variable xfMisc(anchor)
  37.  
  38.   radiobutton $xfRoot.params1.params2.anchor.anchor.f1.w \
  39.     -anchor w \
  40.     -text {W} \
  41.     -variable xfMisc(anchor)
  42.  
  43.   radiobutton $xfRoot.params1.params2.anchor.anchor.f1.sw \
  44.     -anchor w \
  45.     -text {SW} \
  46.     -variable xfMisc(anchor)
  47.  
  48.   radiobutton $xfRoot.params1.params2.anchor.anchor.f2.n \
  49.     -anchor w \
  50.     -text {N} \
  51.     -variable xfMisc(anchor)
  52.  
  53.   radiobutton $xfRoot.params1.params2.anchor.anchor.f2.c \
  54.     -anchor w \
  55.     -text {C} \
  56.     -variable xfMisc(anchor)
  57.  
  58.   radiobutton $xfRoot.params1.params2.anchor.anchor.f2.s \
  59.     -anchor w \
  60.     -text {S} \
  61.     -variable xfMisc(anchor)
  62.  
  63.   radiobutton $xfRoot.params1.params2.anchor.anchor.f3.ne \
  64.     -anchor w \
  65.     -text {NE} \
  66.     -variable xfMisc(anchor)
  67.  
  68.   radiobutton $xfRoot.params1.params2.anchor.anchor.f3.e \
  69.     -anchor w \
  70.     -text {E} \
  71.     -variable xfMisc(anchor)
  72.  
  73.   radiobutton $xfRoot.params1.params2.anchor.anchor.f3.se \
  74.     -anchor w \
  75.     -text {SE} \
  76.     -variable xfMisc(anchor)
  77.  
  78.   if {"$xfType" == "add"} {
  79.     $xfRoot.params1.params2.anchor.anchor.f2.c select
  80.   } {
  81.     case [lindex [$xfW configure -anchor] 4] in {
  82.       {nw} {
  83.         $xfRoot.params1.params2.anchor.anchor.f1.nw select
  84.       }
  85.       {w} {
  86.         $xfRoot.params1.params2.anchor.anchor.f1.w select
  87.       }
  88.       {sw} {
  89.         $xfRoot.params1.params2.anchor.anchor.f1.sw select
  90.       }
  91.       {n} {
  92.         $xfRoot.params1.params2.anchor.anchor.f2.n select
  93.       }
  94.       {c} {
  95.         $xfRoot.params1.params2.anchor.anchor.f2.c select
  96.       }
  97.       {s} {
  98.         $xfRoot.params1.params2.anchor.anchor.f2.s select
  99.       }
  100.       {ne} {
  101.         $xfRoot.params1.params2.anchor.anchor.f3.ne select
  102.       }
  103.       {e} {
  104.         $xfRoot.params1.params2.anchor.anchor.f3.e select
  105.       }
  106.       {se} {
  107.         $xfRoot.params1.params2.anchor.anchor.f3.se select
  108.       }
  109.       {default} {
  110.         $xfRoot.params1.params2.anchor.anchor.f2.c select
  111.       }
  112.     }
  113.   }
  114.   if {"$xfType" != "add"} {
  115.     $xfRoot.params1.params2.anchor.anchor.f1.nw configure \
  116.       -command "$xfFunction $xfW 0 $xfClass"
  117.  
  118.     $xfRoot.params1.params2.anchor.anchor.f1.w configure \
  119.       -command "$xfFunction $xfW 0 $xfClass"
  120.  
  121.     $xfRoot.params1.params2.anchor.anchor.f1.sw configure \
  122.       -command "$xfFunction $xfW 0 $xfClass"
  123.  
  124.     $xfRoot.params1.params2.anchor.anchor.f2.n configure \
  125.       -command "$xfFunction $xfW 0 $xfClass"
  126.  
  127.     $xfRoot.params1.params2.anchor.anchor.f2.c configure \
  128.       -command "$xfFunction $xfW 0 $xfClass"
  129.  
  130.     $xfRoot.params1.params2.anchor.anchor.f2.s configure \
  131.       -command "$xfFunction $xfW 0 $xfClass"
  132.  
  133.     $xfRoot.params1.params2.anchor.anchor.f3.ne configure \
  134.       -command "$xfFunction $xfW 0 $xfClass"
  135.  
  136.     $xfRoot.params1.params2.anchor.anchor.f3.e configure \
  137.       -command "$xfFunction $xfW 0 $xfClass"
  138.  
  139.     $xfRoot.params1.params2.anchor.anchor.f3.se configure \
  140.       -command "$xfFunction $xfW 0 $xfClass"
  141.   }
  142.  
  143.   # packing of subwidgets
  144.   pack append $xfRoot.params1.params2.anchor.anchor.f1 \
  145.               $xfRoot.params1.params2.anchor.anchor.f1.nw {top fillx} \
  146.               $xfRoot.params1.params2.anchor.anchor.f1.w {top fillx} \
  147.               $xfRoot.params1.params2.anchor.anchor.f1.sw {top fillx}
  148.   pack append $xfRoot.params1.params2.anchor.anchor.f2 \
  149.               $xfRoot.params1.params2.anchor.anchor.f2.n {top fillx} \
  150.               $xfRoot.params1.params2.anchor.anchor.f2.c {top fillx} \
  151.               $xfRoot.params1.params2.anchor.anchor.f2.s {top fillx}
  152.   pack append $xfRoot.params1.params2.anchor.anchor.f3 \
  153.               $xfRoot.params1.params2.anchor.anchor.f3.ne {top fillx} \
  154.               $xfRoot.params1.params2.anchor.anchor.f3.e {top fillx} \
  155.               $xfRoot.params1.params2.anchor.anchor.f3.se {top fillx}
  156.   pack append $xfRoot.params1.params2.anchor.anchor \
  157.               $xfRoot.params1.params2.anchor.anchor.f1 {left frame center} \
  158.               $xfRoot.params1.params2.anchor.anchor.f2 {left frame center} \
  159.               $xfRoot.params1.params2.anchor.anchor.f3 {left frame center}
  160.   pack append $xfRoot.params1.params2.anchor \
  161.               $xfRoot.params1.params2.anchor.label1 {top frame center} \
  162.               $xfRoot.params1.params2.anchor.anchor {top frame center}
  163.   pack append $xfRoot.params1.params2 \
  164.               $xfRoot.params1.params2.anchor {top fillx pady 6}  
  165. }
  166.  
  167. ##########
  168. # Procedure: XFElementAspect
  169. # Description: build aspect frame
  170. # Arguments: xfW - the widget we configure
  171. #            xfRoot - the root name
  172. #            xfType - add or config
  173. #            xfClass - the class we configure
  174. #            xfFunction - the function that sets the values
  175. # Returns: none
  176. # Sideeffects: none
  177. ##########
  178. proc XFElementAspect {xfW xfRoot xfType xfClass xfFunction} {
  179.   global xfStatus
  180.  
  181.   if {"$xfType" == "add"} {
  182.     XFTmpltScale $xfRoot.params1.params2 aspect \
  183.       "Aspect:" "100*width/height" 2000
  184.     $xfRoot.params1.params2.aspect.aspect set 1500
  185.   } {
  186.     XFTmpltScale $xfRoot.params1.params2 aspect \
  187.       "Aspect:" "100*width/height" 2000 \
  188.         [lindex [$xfW configure -aspect] 4]
  189.   }
  190.  
  191.   XFMiscSetResource $xfRoot.params1.params2.aspect.aspect \
  192.     relief sunken
  193.   XFMiscSetResource $xfRoot.params1.params2.aspect.label1 \
  194.     width $xfStatus(elementWidth)
  195.   XFMiscSetResource $xfRoot.params1.params2.aspect.label1 \
  196.     anchor e
  197.   XFMiscSetResource $xfRoot.params1.params2.aspect.label1 \
  198.     relief flat
  199.   if {"$xfType" != "add"} {
  200.     XFMiscSetResource $xfRoot.params1.params2.aspect.aspect \
  201.       command "$xfFunction $xfW 0 $xfClass"
  202.   }
  203.  
  204.   # packing of subwidgets
  205.   pack append $xfRoot.params1.params2 \
  206.               $xfRoot.params1.params2.aspect {top fillx pady 6}
  207. }
  208.  
  209. ##########
  210. # Procedure: XFElementBitmap
  211. # Description: build bitmap frame
  212. # Arguments: xfW - the widget we configure
  213. #            xfRoot - the root name
  214. #            xfType - add or config
  215. #            xfClass - the class we configure
  216. #            xfFunction - the function that sets the values
  217. # Returns: none
  218. # Sideeffects: none
  219. ##########
  220. proc XFElementBitmap {xfW xfRoot xfType xfClass xfFunction} {
  221.   global xfBind
  222.  
  223.   if {"$xfType" == "add"} {
  224.     XFTmpltLabledEntry $xfRoot.params1.params2 bitmap "Bitmap:"
  225.     if {"[$xfW configure -bitmap]" != ""} {
  226.       $xfRoot.params1.params2.bitmap.bitmap insert 0 \
  227.         [lindex [$xfW configure -bitmap] 4]
  228.     }
  229.   } {
  230.     XFTmpltLabledEntry $xfRoot.params1.params2 bitmap "Bitmap:" \
  231.       [lindex [$xfW configure -bitmap] 4]
  232.   }
  233.  
  234.   XFMiscInitElement $xfRoot bitmap
  235.  
  236.   # bindings
  237.   bind $xfRoot.params1.params2.bitmap.bitmap $xfBind(configure) "
  238.     XFProcFSBoxPixmap {$xfRoot.params1.params2.bitmap.bitmap}"
  239.   if {"$xfType" != "add"} {
  240.     bind $xfRoot.params1.params2.bitmap.bitmap <Return> \
  241.       "$xfFunction $xfW 0 $xfClass"
  242.   }
  243.  
  244.   # packing of subwidgets
  245.   pack append $xfRoot.params1.params2 \
  246.               $xfRoot.params1.params2.bitmap {top fillx pady 6}
  247. }
  248.  
  249. ##########
  250. # Procedure: XFElementBoolean
  251. # Description: build boolean frame
  252. # Arguments: xfW - the widget we configure
  253. #            xfRoot - the root name
  254. #            xfType - add or config
  255. #            xfClass - the class we configure
  256. #            xfName - the name of the resource
  257. #            xfLabel - the label to display
  258. #            xfFunction - the function that sets the values
  259. # Returns: none
  260. # Sideeffects: none
  261. ##########
  262. proc XFElementBoolean {xfW xfRoot xfType xfClass xfName xfLabel xfFunction} {
  263.   global xfMisc
  264.  
  265.   set xfMisc($xfName) 0
  266.  
  267.   XFTmpltFrame $xfRoot.params1.params2.$xfName 0
  268.  
  269.   checkbutton $xfRoot.params1.params2.$xfName.$xfName \
  270.     -offvalue 0 \
  271.     -onvalue 1 \
  272.     -relief raised \
  273.     -variable xfMisc($xfName) \
  274.     -text "$xfLabel"
  275.  
  276.   set xfTmpValue [lindex [$xfW configure -[string tolower $xfName]] 4]
  277.   if {"$xfTmpValue" == "1" || "$xfTmpValue" == "on" ||
  278.       "$xfTmpValue" == "true"} {
  279.     $xfRoot.params1.params2.$xfName.$xfName select
  280.   } {
  281.     $xfRoot.params1.params2.$xfName.$xfName deselect
  282.   }
  283.   if {"$xfType" != "add"} {
  284.     $xfRoot.params1.params2.$xfName.$xfName configure \
  285.       -command "$xfFunction $xfW 0 $xfClass"
  286.   }
  287.  
  288.   # packing of subwidgets
  289.   pack append $xfRoot.params1.params2.$xfName \
  290.               $xfRoot.params1.params2.$xfName.$xfName {top frame center}
  291.   pack append $xfRoot.params1.params2 \
  292.               $xfRoot.params1.params2.$xfName {top fillx pady 6}
  293. }
  294.  
  295. ##########
  296. # Procedure: XFElementColor
  297. # Description: build color frame
  298. # Arguments: xfW - the widget we configure
  299. #            xfRoot - the root name
  300. #            xfType - add or config
  301. #            xfClass - the class we configure
  302. #            xfName - the name of the widget
  303. #            xfResource - the resource
  304. #            xfResClass - the resource class
  305. #            xfLabel - the label
  306. #            xfFunction - the function that sets the values
  307. # Returns: none
  308. # Sideeffects: none
  309. ##########
  310. proc XFElementColor {xfW xfRoot xfType xfClass xfName xfResource \
  311.                      xfResClass xfLabel xfFunction} {
  312.   global xfBind
  313.  
  314.   if {"$xfType" == "config" || "$xfW" != "."} {
  315.     XFTmpltLabledEntry $xfRoot.params1.params2 $xfName "$xfLabel:" \
  316.       [lindex [$xfW configure -[string tolower $xfResource]] 4]
  317.   } {
  318.     XFTmpltLabledEntry $xfRoot.params1.params2 $xfName "$xfLabel:"
  319.   }
  320.  
  321.   XFMiscInitElement $xfRoot $xfName
  322.  
  323.   # bindings
  324.   bind $xfRoot.params1.params2.$xfName.$xfName $xfBind(configure) \
  325.     "global xfConf
  326.      if {\$xfConf(applyParameters)} {
  327.        XFProcColorBox \"[string tolower [string trimleft $xfResource -]]\" \
  328.      {$xfRoot.params1.params2.$xfName.$xfName} $xfW
  329.      } {
  330.        XFProcColorBox \"[string tolower [string trimleft $xfResource -]]\" \
  331.      {$xfRoot.params1.params2.$xfName.$xfName} \
  332.      }"
  333.   if {"$xfType" != "add"} {
  334.     bind $xfRoot.params1.params2.$xfName.$xfName <Return> \
  335.       "$xfFunction $xfW 0 $xfClass"
  336.   }
  337.  
  338.   # packing of subwidgets
  339.   pack append $xfRoot.params1.params2 \
  340.               $xfRoot.params1.params2.$xfName {top fillx pady 6}
  341. }
  342.  
  343. ##########
  344. # Procedure: XFElementCommand
  345. # Description: build command frame
  346. # Arguments: xfW - the widget we configure
  347. #            xfRoot - the root name
  348. #            xfType - add or config
  349. # Returns: none
  350. # Sideeffects: none
  351. ##########
  352. proc XFElementCommand {xfW xfRoot xfType {specialFlag 0}} {
  353.   global xfBind
  354.  
  355.   XFTmpltFrame $xfRoot.params1.params2.command 0
  356.  
  357.   if {$specialFlag == 0} {
  358.     label $xfRoot.params1.params2.command.label1 \
  359.       -text "Command:"
  360.  
  361.     XFTmpltText $xfRoot.params1.params2.command command 0 \
  362.       [lindex [$xfW configure -command] 4]
  363.   } {
  364.     label $xfRoot.params1.params2.command.label1 \
  365.       -text "Post command:"
  366.  
  367.     XFTmpltText $xfRoot.params1.params2.command command 0 \
  368.       [lindex [$xfW configure -postcommand] 4]
  369.   }
  370.  
  371.   # bindings
  372.   bind $xfRoot.params1.params2.command.command.command $xfBind(configure) \
  373.     "XFInfoCommands $xfRoot.params1.params2.command.command.command"
  374.  
  375.   # packing of subwidgets
  376.   pack append $xfRoot.params1.params2.command \
  377.               $xfRoot.params1.params2.command.label1 {top frame center} \
  378.               $xfRoot.params1.params2.command.command {top fill expand}
  379.   pack append $xfRoot.params1.params2 \
  380.               $xfRoot.params1.params2.command {top fill expand}  
  381. }
  382.  
  383. ##########
  384. # Procedure: XFElementCursor
  385. # Description: build cursor frame
  386. # Arguments: xfW - the widget we configure
  387. #            xfRoot - the root name
  388. #            xfType - add or config
  389. #            xfClass - the class we configure
  390. #            xfFunction - the function that sets the values
  391. # Returns: none
  392. # Sideeffects: none
  393. ##########
  394. proc XFElementCursor {xfW xfRoot xfType xfClass xfFunction} {
  395.   global xfBind
  396.  
  397.   XFTmpltLabledEntry $xfRoot.params1.params2 cursor "Cursor:" \
  398.     [lindex [$xfW configure -cursor] 4]
  399.  
  400.   XFMiscInitElement $xfRoot cursor
  401.  
  402.   # bindings
  403.   bind $xfRoot.params1.params2.cursor.cursor $xfBind(configure) \
  404.     "global xfConf
  405.      if {\$xfConf(applyParameters)} {
  406.        XFProcCursorBox cursor {$xfRoot.params1.params2.cursor.cursor} $xfW
  407.      } {
  408.        XFProcCursorBox cursor {$xfRoot.params1.params2.cursor.cursor}
  409.      }"
  410.   if {"$xfType" != "add"} {
  411.     bind $xfRoot.params1.params2.cursor.cursor <Return> \
  412.       "$xfFunction $xfW 0 $xfClass"
  413.   }
  414.  
  415.   # packing of subwidgets
  416.   pack append $xfRoot.params1.params2 \
  417.               $xfRoot.params1.params2.cursor {top fillx pady 6}
  418. }
  419.  
  420. ##########
  421. # Procedure: XFElementFont
  422. # Description: build font frame
  423. # Arguments: xfW - the widget we configure
  424. #            xfRoot - the root name
  425. #            xfType - add or config
  426. #            xfClass - the class we configure
  427. #            xfName - the name of the widget
  428. #            xfResource - the resource
  429. #            xfResClass - the resource class
  430. #            xfLabel - the label
  431. #            xfFunction - the function that sets the values
  432. # Returns: none
  433. # Sideeffects: none
  434. ##########
  435. proc XFElementFont {xfW xfRoot xfType xfClass xfName xfResource xfResClass xfLabel xfFunction} {
  436.   global xfBind
  437.  
  438.   XFTmpltLabledEntry $xfRoot.params1.params2 $xfName "$xfLabel:" \
  439.     [lindex [$xfW configure -[string tolower $xfResource]] 4]
  440.  
  441.   XFMiscInitElement $xfRoot $xfName
  442.  
  443.   # bindings
  444.   bind $xfRoot.params1.params2.$xfName.$xfName $xfBind(configure) \
  445.     "global xfConf
  446.      if {\$xfConf(applyParameters)} {
  447.        XFProcFontBox \"$xfResource\" {$xfRoot.params1.params2.$xfName.$xfName} $xfW
  448.      } {
  449.        XFFontFontBox \"$xfResource\" {$xfRoot.params1.params2.$xfName.$xfName}
  450.      }"
  451.   if {"$xfType" != "add"} {
  452.     bind $xfRoot.params1.params2.$xfName.$xfName <Return> \
  453.       "$xfFunction $xfW 0 $xfClass"
  454.   }
  455.  
  456.   # packing of subwidgets
  457.   pack append $xfRoot.params1.params2 \
  458.               $xfRoot.params1.params2.$xfName {top fillx pady 6}
  459. }
  460.  
  461. ##########
  462. # Procedure: XFElementGeometry
  463. # Description: build geometry frame
  464. # Arguments: xfW - the widget we configure
  465. #            xfRoot - the root name
  466. #            xfType - add or config
  467. #            xfClass - the class we configure
  468. #            xfFunction - the function that sets the values
  469. # Returns: none
  470. # Sideeffects: none
  471. ##########
  472. proc XFElementGeometry {xfW xfRoot xfType xfClass xfFunction} {
  473.   global xfStatus
  474.  
  475.   if {"[string tolower $xfClass]" == "listbox"} {
  476.     XFTmpltScaleDouble $xfRoot.params1.params2 geo "Geometry:" \
  477.       "Width" "Height" 500 500
  478.   } {
  479.     XFTmpltScaleDouble $xfRoot.params1.params2 geo "Geometry:" \
  480.       "Width" "Height" 1000 1000
  481.   }
  482.  
  483.   set xfGeoWidth ""
  484.   set xfGeoHeight ""
  485.   set xfGeo [lindex [$xfW configure -geometry] 4]
  486.   if {"$xfGeo]" != ""} {
  487.     set xfGeoWidth [string range $xfGeo 0 [expr [string last "x" $xfGeo]-1]]
  488.     set xfGeoHeight [string range $xfGeo [expr [string last "x" $xfGeo]+1] end]
  489.   }
  490.   if {"$xfGeoWidth" != ""} {
  491.     $xfRoot.params1.params2.geo.geo1.geo1 set $xfGeoWidth
  492.   }
  493.   if {"$xfGeoHeight" != ""} {
  494.     $xfRoot.params1.params2.geo.geo2.geo2 set $xfGeoHeight
  495.   }
  496.  
  497.   XFMiscSetResource $xfRoot.params1.params2.geo.geo1.geo1 \
  498.     relief sunken
  499.   XFMiscSetResource $xfRoot.params1.params2.geo.geo2.geo2 \
  500.     relief sunken
  501.   XFMiscSetResource $xfRoot.params1.params2.geo.label1 \
  502.     width $xfStatus(elementWidth)
  503.   XFMiscSetResource $xfRoot.params1.params2.geo.label1 \
  504.     anchor e
  505.   XFMiscSetResource $xfRoot.params1.params2.geo.label1 \
  506.     relief flat
  507.   if {"$xfType" != "add"} {
  508.     XFMiscSetResource $xfRoot.params1.params2.geo.geo1.geo1 \
  509.       command "$xfFunction $xfW 0 $xfClass"
  510.     XFMiscSetResource $xfRoot.params1.params2.geo.geo2.geo2 \
  511.       command "$xfFunction $xfW 0 $xfClass"
  512.   }
  513.  
  514.   # packing of subwidgets
  515.   pack append $xfRoot.params1.params2 \
  516.               $xfRoot.params1.params2.geo {top fillx pady 6}
  517. }
  518.  
  519. ##########
  520. # Procedure: XFElementInit
  521. # Description: build common window structure for configuration
  522. # Arguments: xfW - the widget we configure
  523. #            xfRoot - the root name
  524. #            xfType - add or config
  525. #            xfClass - the class we configure
  526. #            xfFunction - the function that sets the values
  527. #            xfMessage - The top message
  528. #            xfName - the name for a newly created widget
  529. #            xfDialog - which type of configuration
  530. # Returns: none
  531. # Sideeffects: none
  532. ##########
  533. proc XFElementInit {xfW xfRoot xfType xfClass xfFunction xfMessage xfName xfDialog} {
  534.   global symbolicName
  535.   global xfConf
  536.   global xfStatus
  537.  
  538.   XFTmpltFrame $xfRoot.leave 0
  539.  
  540.   XFTmpltFrame $xfRoot.additional 0
  541.  
  542.   XFTmpltFrame $xfRoot.params1
  543.  
  544.   XFTmpltFrame $xfRoot.params1.params2 0
  545.  
  546.   XFTmpltFrame $xfRoot.params1.params2.name 0
  547.  
  548.   XFTmpltFrame $xfRoot.params1.params2.symname 0
  549.  
  550.   label $xfRoot.params1.params2.name.label1 \
  551.     -anchor e \
  552.     -width $xfStatus(elementWidth) \
  553.     -text {Name:}
  554.  
  555.   if {"$xfType" == "add"} {
  556.     entry $xfRoot.params1.params2.name.name \
  557.       -relief sunken
  558.   } {
  559.     label $xfRoot.params1.params2.name.name \
  560.       -anchor w
  561.   }
  562.  
  563.   label $xfRoot.params1.params2.symname.label1 \
  564.     -anchor e \
  565.     -width $xfStatus(elementWidth) \
  566.     -text {Symbolic name:}
  567.  
  568.   entry $xfRoot.params1.params2.symname.symname \
  569.     -relief sunken
  570.  
  571.   if {"$xfType" == "add"} {
  572.     button $xfRoot.leave.ok \
  573.       -text {OK} \
  574.       -command "
  575.         global xfConf
  576.         global xfStatus
  577.         if {\"\[$xfRoot.params1.params2.name.name get\]\" != \"\"} {
  578.           set xfTmpValue \$xfConf(getWidgetName)
  579.           set xfConf(getWidgetName) 0
  580.           if {\[catch \"XFAdd.$xfClass $xfW \[$xfRoot.params1.params2.name.name get\] config@\" xfResult\]} {
  581.             XFProcError \$xfResult
  582.             XFEditSetStatus \"Insertion of widget...aborted\"
  583.           }
  584.           set xfConf(getWidgetName) \$xfTmpValue
  585.           if {\"[string tolower $xfClass]\" == \"toplevel\"} {
  586.             $xfFunction .\[$xfRoot.params1.params2.name.name get\] 1 $xfClass
  587.             XFEditSetPath \$xfStatus(path)
  588.             XFEditSetShowWindows
  589.           } {
  590.             if {\"\$xfStatus(path)\" == \".\"} {
  591.               $xfFunction .\[$xfRoot.params1.params2.name.name get\] 1 $xfClass
  592.             } {
  593.               $xfFunction \$xfStatus(path).\[$xfRoot.params1.params2.name.name get\] 1 $xfClass
  594.             }
  595.           }
  596.         }
  597.         destroy $xfRoot"
  598.  
  599.     button $xfRoot.leave.apply \
  600.       -text {Apply} \
  601.       -state disabled
  602.  
  603.     checkbutton $xfRoot.leave.applyperm \
  604.       -text {Apply permanently} \
  605.       -state disabled \
  606.       -variable xfConf(applyParameters) \
  607.       -onvalue 1 \
  608.       -offvalue 0
  609.  
  610.     button $xfRoot.leave.cancel \
  611.       -text {Cancel} \
  612.       -command "destroy $xfRoot"
  613.   } {
  614.     button $xfRoot.leave.ok \
  615.       -text {OK} \
  616.       -command "
  617.         $xfFunction $xfW 1 $xfClass
  618.         destroy $xfRoot"
  619.  
  620.     button $xfRoot.leave.apply \
  621.       -text {Apply} \
  622.       -command "$xfFunction $xfW 1 $xfClass"
  623.  
  624.     checkbutton $xfRoot.leave.applyperm \
  625.       -text {Apply permanently} \
  626.       -variable xfConf(applyParameters) \
  627.       -onvalue 1 \
  628.       -offvalue 0 \
  629.       -command "$xfFunction $xfW 0 $xfClass"
  630.  
  631.     button $xfRoot.leave.cancel \
  632.       -text {Cancel} \
  633.       -command "
  634.         global xfMisc
  635.         if {\[info exists xfMisc($xfClass,saveValue)\]} {
  636.           foreach xfCounter \$xfMisc($xfClass,saveValue) {
  637.             catch \"$xfW config -\[lindex \$xfCounter 0\] \\\"\[lindex \$xfCounter 1\]\\\"\"
  638.           }
  639.         }
  640.         destroy $xfRoot"
  641.  
  642.     if {$xfDialog == 4} {
  643.       button $xfRoot.additional.params \
  644.         -text {Special} \
  645.         -command "
  646.           XFProcConfConfigure $xfW 5 .xf${xfClass}Config$xfDialog $xfClass $xfType"
  647.     } {
  648.       button $xfRoot.additional.params \
  649.         -text {Small} \
  650.         -command "
  651.           XFProcConfConfigure $xfW 4 .xf${xfClass}Config$xfDialog $xfClass $xfType"
  652.     }
  653.  
  654.     button $xfRoot.additional.general \
  655.       -text {General} \
  656.       -command "
  657.         XFProcConfParametersGeneral $xfW .xf${xfClass}Config$xfDialog"
  658.  
  659.     button $xfRoot.additional.packing \
  660.       -text {Geometry} \
  661.       -command "
  662.         XFProcConfGeometryDefault $xfW .xf${xfClass}Config$xfDialog"
  663.   
  664.     button $xfRoot.additional.binding \
  665.       -text {Binding} \
  666.       -command "
  667.         XFProcConfConfigure $xfW 3 .xf${xfClass}Config$xfDialog $xfClass $xfType"
  668.  
  669.     pack append $xfRoot.additional \
  670.                 $xfRoot.additional.params {left fill expand} \
  671.                 $xfRoot.additional.general {left fill expand} \
  672.                 $xfRoot.additional.packing {left fill expand} \
  673.                 $xfRoot.additional.binding {left fill expand}
  674.   }
  675.   
  676.   XFElementPathname $xfW $xfRoot $xfType
  677.   if {"$xfType" == "add"} {
  678.     $xfRoot.params1.params2.name.name insert 0 $xfName
  679.   } {
  680.     if {"[string tolower $xfClass]" == "toplevel"} {
  681.       $xfRoot.params1.params2.name.name configure \
  682.         -text [winfo name $xfW]
  683.     } {
  684.       $xfRoot.params1.params2.name.name configure \
  685.         -text [string range $xfW [expr [string last . $xfW]+1] end]
  686.     }
  687.     foreach xfCounter [array names symbolicName] {
  688.       set xfArrayName ""
  689.       append xfArrayName symbolicName ( $xfCounter )
  690.       if {"$xfW" == "[set $xfArrayName]"} {
  691.         $xfRoot.params1.params2.symname.symname insert 0 $xfCounter
  692.       }
  693.     }
  694.   }
  695.  
  696.   # packing of subwidgets
  697.   pack append $xfRoot.params1.params2.name \
  698.               $xfRoot.params1.params2.name.label1 {left} \
  699.               $xfRoot.params1.params2.name.name {left fillx expand}
  700.   pack append $xfRoot.params1.params2.symname \
  701.               $xfRoot.params1.params2.symname.label1 {left} \
  702.               $xfRoot.params1.params2.symname.symname {left fillx expand}
  703.   pack append $xfRoot.leave \
  704.               $xfRoot.leave.ok {left fill expand} \
  705.               $xfRoot.leave.apply {left fill expand} \
  706.               $xfRoot.leave.applyperm {left fill expand} \
  707.               $xfRoot.leave.cancel {left fill expand}
  708.   pack append $xfRoot.params1.params2 \
  709.               $xfRoot.params1.params2.name {top fillx pady 6} \
  710.               $xfRoot.params1.params2.symname {top fillx pady 6}
  711.   pack append $xfRoot.params1 \
  712.               $xfRoot.params1.params2 {top frame nw fill expand}
  713. }
  714.  
  715. ##########
  716. # Procedure: XFElementJustify
  717. # Description: build justify frame
  718. # Arguments: xfW - the widget we configure
  719. #            xfRoot - the root name
  720. #            xfType - add or config
  721. #            xfClass - the class we configure
  722. #            xfFunction - the function that sets the values
  723. # Returns: none
  724. # Sideeffects: none
  725. ##########
  726. proc XFElementJustify {xfW xfRoot xfType xfClass xfFunction} {
  727.   global xfMisc
  728.   global xfStatus
  729.  
  730.   set xfMisc(justify) center
  731.  
  732.   XFTmpltFrame $xfRoot.params1.params2.justify 0
  733.  
  734.   label $xfRoot.params1.params2.justify.label1 \
  735.     -anchor e \
  736.     -width $xfStatus(elementWidth) \
  737.     -text "Justify:"
  738.  
  739.   radiobutton $xfRoot.params1.params2.justify.left \
  740.     -text "Left" \
  741.     -variable xfMisc(justify)
  742.  
  743.   radiobutton $xfRoot.params1.params2.justify.center \
  744.     -text "Center" \
  745.     -variable xfMisc(justify)
  746.  
  747.   radiobutton $xfRoot.params1.params2.justify.right \
  748.     -text "Right" \
  749.     -variable xfMisc(justify)
  750.  
  751.   if {"$xfType" == "add"} {
  752.     $xfRoot.params1.params2.justify.center select
  753.   } {
  754.     case [lindex [$xfW configure -justify] 4] in {
  755.       {left} {
  756.         $xfRoot.params1.params2.justify.left select
  757.       }
  758.       {right} {
  759.         $xfRoot.params1.params2.justify.right select
  760.       }
  761.       {default} {
  762.         $xfRoot.params1.params2.justify.center select
  763.       }
  764.     }
  765.   }
  766.   if {"$xfType" != "add"} {
  767.     $xfRoot.params1.params2.justify.left configure \
  768.       -command "$xfFunction $xfW 0 $xfClass"
  769.  
  770.     $xfRoot.params1.params2.justify.center configure \
  771.       -command "$xfFunction $xfW 0 $xfClass"
  772.  
  773.     $xfRoot.params1.params2.justify.right configure \
  774.       -command "$xfFunction $xfW 0 $xfClass"
  775.   }
  776.  
  777.   # packing of subwidgets
  778.   pack append $xfRoot.params1.params2.justify \
  779.               $xfRoot.params1.params2.justify.label1 {left} \
  780.               $xfRoot.params1.params2.justify.left {left fillx expand} \
  781.               $xfRoot.params1.params2.justify.center {left fillx expand} \
  782.               $xfRoot.params1.params2.justify.right {left fillx expand}
  783.   pack append $xfRoot.params1.params2 \
  784.               $xfRoot.params1.params2.justify {top fillx pady 6}
  785. }
  786.  
  787. ##########
  788. # Procedure: XFElementOrient
  789. # Description: build orient frame
  790. # Arguments: xfW - the widget we configure
  791. #            xfRoot - the root name
  792. #            xfType - add or config
  793. #            xfClass - the class we configure
  794. #            xfFunction - the function that sets the values
  795. # Returns: none
  796. # Sideeffects: none
  797. ##########
  798. proc XFElementOrient {xfW xfRoot xfType xfClass xfFunction} {
  799.   global xfMisc
  800.   global xfStatus
  801.  
  802.   set xfMisc(orient) horizontal
  803.  
  804.   XFTmpltFrame $xfRoot.params1.params2.orient 0
  805.  
  806.   label $xfRoot.params1.params2.orient.label1 \
  807.     -anchor e \
  808.     -width $xfStatus(elementWidth) \
  809.     -text "Orient:"
  810.  
  811.   radiobutton $xfRoot.params1.params2.orient.horizontal \
  812.     -text "Horizontal" \
  813.     -variable xfMisc(orient)
  814.  
  815.   radiobutton $xfRoot.params1.params2.orient.vertical \
  816.     -text "Vertical" \
  817.     -variable xfMisc(orient)
  818.  
  819.   if {"$xfType" == "add"} {
  820.     $xfRoot.params1.params2.orient.vertical select
  821.   } {
  822.     case [lindex [$xfW configure -orient] 4] in {
  823.       {h*} {
  824.         $xfRoot.params1.params2.orient.horizontal select
  825.       }
  826.       {default} {
  827.         $xfRoot.params1.params2.orient.vertical select
  828.       }
  829.     }
  830.   }
  831.   if {"$xfType" != "add"} {
  832.     $xfRoot.params1.params2.orient.horizontal configure \
  833.       -command "$xfFunction $xfW 0 $xfClass"
  834.  
  835.     $xfRoot.params1.params2.orient.vertical configure \
  836.       -command "$xfFunction $xfW 0 $xfClass"
  837.   }
  838.  
  839.   # packing of subwidgets
  840.   pack append $xfRoot.params1.params2.orient \
  841.               $xfRoot.params1.params2.orient.label1 {left} \
  842.               $xfRoot.params1.params2.orient.horizontal {left fillx expand} \
  843.               $xfRoot.params1.params2.orient.vertical {left fillx expand}
  844.   pack append $xfRoot.params1.params2 \
  845.               $xfRoot.params1.params2.orient {top fillx pady 6}
  846. }
  847.  
  848. ##########
  849. # Procedure: XFElementPad
  850. # Description: build pad frame
  851. # Arguments: xfW - the widget we configure
  852. #            xfRoot - the root name
  853. #            xfType - add or config
  854. #            xfClass - the class we configure
  855. #            xfFunction - the function that sets the values
  856. # Returns: none
  857. # Sideeffects: none
  858. ##########
  859. proc XFElementPad {xfW xfRoot xfType xfClass xfFunction} {
  860.   global xfStatus
  861.  
  862.   XFTmpltScaleDouble $xfRoot.params1.params2 pad "Pad:" "x" "y" \
  863.     250 250
  864.  
  865.   $xfRoot.params1.params2.pad.pad1.pad1 set [lindex [$xfW configure -padx] 4]
  866.   $xfRoot.params1.params2.pad.pad2.pad2 set [lindex [$xfW configure -pady] 4]
  867.  
  868.   XFMiscSetResource $xfRoot.params1.params2.pad.pad1.pad1 \
  869.     relief sunken
  870.   XFMiscSetResource $xfRoot.params1.params2.pad.pad2.pad2 \
  871.     relief sunken
  872.   XFMiscSetResource $xfRoot.params1.params2.pad.label1 \
  873.     width $xfStatus(elementWidth)
  874.   XFMiscSetResource $xfRoot.params1.params2.pad.label1 \
  875.     anchor e
  876.   XFMiscSetResource $xfRoot.params1.params2.pad.label1 \
  877.     relief flat
  878.   if {"$xfType" != "add"} {
  879.     XFMiscSetResource $xfRoot.params1.params2.pad.pad1.pad1 \
  880.       command "$xfFunction $xfW 0 $xfClass"
  881.     XFMiscSetResource $xfRoot.params1.params2.pad.pad2.pad2 \
  882.       command "$xfFunction $xfW 0 $xfClass"
  883.   }
  884.  
  885.   # packing of subwidgets
  886.   pack append $xfRoot.params1.params2 \
  887.               $xfRoot.params1.params2.pad {top fillx pady 6}
  888. }
  889.  
  890. ##########
  891. # Procedure: XFElementPathname
  892. # Description: build pathname frame
  893. # Arguments: xfW - the widget we configure
  894. #            xfRoot - the root name
  895. #            xfType - add or config
  896. # Returns: none
  897. # Sideeffects: none
  898. ##########
  899. proc XFElementPathname {xfW xfRoot xfType} {
  900.   global xfStatus
  901.  
  902.   XFTmpltFrame $xfRoot.pathname
  903.  
  904.   XFTmpltFrame $xfRoot.pathname.pathname 0
  905.  
  906.   label $xfRoot.pathname.pathname.label1 \
  907.     -text "Widget path:"
  908.  
  909.   label $xfRoot.pathname.pathname.pathname
  910.  
  911.   if {"$xfType" == "add"} {
  912.     XFMiscSetResource $xfRoot.pathname.pathname.pathname \
  913.       text $xfStatus(path)
  914.   } {
  915.     if {"$xfW" == "."} {
  916.       XFMiscSetResource $xfRoot.pathname.pathname.pathname \
  917.         text "root"
  918.     } {
  919.       if {"[string range $xfW 0 [expr [string last "." $xfW]-1]]" == ""} {
  920.         XFMiscSetResource $xfRoot.pathname.pathname.pathname \
  921.           text "."
  922.       } {
  923.         XFMiscSetResource $xfRoot.pathname.pathname.pathname \
  924.           text [string range $xfW 0 [expr [string last "." $xfW]-1]]
  925.       }
  926.     }
  927.   }
  928.  
  929.   # packing of subwidgets
  930.   pack append $xfRoot.pathname.pathname \
  931.               $xfRoot.pathname.pathname.label1 {left} \
  932.               $xfRoot.pathname.pathname.pathname {left}
  933.   pack append $xfRoot.pathname \
  934.               $xfRoot.pathname.pathname {top}
  935. }
  936.  
  937. ##########
  938. # Procedure: XFElementRelief
  939. # Description: build relief frame
  940. # Arguments: xfW - the widget we configure
  941. #            xfRoot - the root name
  942. #            xfType - add or config
  943. #            xfClass - the class we configure
  944. #            xfFunction - the function that sets the values
  945. # Returns: none
  946. # Sideeffects: none
  947. ##########
  948. proc XFElementRelief {xfW xfRoot xfType xfClass xfFunction} {
  949.   global xfMisc
  950.   global xfStatus
  951.   global tkVersion
  952.  
  953.   set xfMisc(relief) raised
  954.  
  955.   XFTmpltFrame $xfRoot.params1.params2.relief 0
  956.  
  957.   label $xfRoot.params1.params2.relief.label1 \
  958.     -anchor e \
  959.     -width $xfStatus(elementWidth) \
  960.     -text "Relief:"
  961.  
  962.   XFTmpltFrame $xfRoot.params1.params2.relief.relief1 0
  963.  
  964.   XFTmpltFrame $xfRoot.params1.params2.relief.relief2 0
  965.  
  966.   radiobutton $xfRoot.params1.params2.relief.relief1.raised \
  967.     -text "Raised" \
  968.     -variable xfMisc(relief)
  969.  
  970.   radiobutton $xfRoot.params1.params2.relief.relief1.sunken \
  971.     -text "Sunken" \
  972.     -variable xfMisc(relief)
  973.  
  974.   radiobutton $xfRoot.params1.params2.relief.relief1.flat \
  975.     -text "Flat" \
  976.     -variable xfMisc(relief)
  977.  
  978.   radiobutton $xfRoot.params1.params2.relief.relief2.ridge \
  979.     -text "Ridge" \
  980.     -variable xfMisc(relief)
  981.  
  982.   radiobutton $xfRoot.params1.params2.relief.relief2.groove \
  983.     -text "Groove" \
  984.     -variable xfMisc(relief)
  985.  
  986.   if {"$xfType" == "add"} {
  987.     $xfRoot.params1.params2.relief.relief1.raised select
  988.   } {
  989.     case [lindex [$xfW configure -relief] 4] in {
  990.       {sunken} {
  991.         $xfRoot.params1.params2.relief.relief1.sunken select
  992.       }
  993.       {flat} {
  994.         $xfRoot.params1.params2.relief.relief1.flat select
  995.       }
  996.       {ridge} {
  997.         $xfRoot.params1.params2.relief.relief2.ridge select
  998.       }
  999.       {groove} {
  1000.         $xfRoot.params1.params2.relief.relief2.groove select
  1001.       }
  1002.       {default} {
  1003.         $xfRoot.params1.params2.relief.relief1.raised select
  1004.       }
  1005.     }
  1006.   }
  1007.   if {"$xfType" != "add"} {
  1008.     $xfRoot.params1.params2.relief.relief1.raised configure \
  1009.       -command "$xfFunction $xfW 0 $xfClass"
  1010.  
  1011.     $xfRoot.params1.params2.relief.relief1.sunken configure \
  1012.       -command "$xfFunction $xfW 0 $xfClass"
  1013.  
  1014.     $xfRoot.params1.params2.relief.relief1.flat configure \
  1015.       -command "$xfFunction $xfW 0 $xfClass"
  1016.  
  1017.     $xfRoot.params1.params2.relief.relief2.ridge configure \
  1018.       -command "$xfFunction $xfW 0 $xfClass"
  1019.  
  1020.     $xfRoot.params1.params2.relief.relief2.groove configure \
  1021.       -command "$xfFunction $xfW 0 $xfClass"
  1022.   }
  1023.  
  1024.   # packing of subwidgets
  1025.   pack append $xfRoot.params1.params2.relief.relief1 \
  1026.               $xfRoot.params1.params2.relief.relief1.raised {left fillx expand} \
  1027.               $xfRoot.params1.params2.relief.relief1.sunken {left fillx expand} \
  1028.               $xfRoot.params1.params2.relief.relief1.flat {left fillx expand}
  1029.   pack append $xfRoot.params1.params2.relief.relief2 \
  1030.               $xfRoot.params1.params2.relief.relief2.ridge {left fillx expand} \
  1031.               $xfRoot.params1.params2.relief.relief2.groove {left fillx expand}
  1032.   if {$tkVersion >= 3.3} {
  1033.     pack append $xfRoot.params1.params2.relief \
  1034.                 $xfRoot.params1.params2.relief.label1 {left} \
  1035.                 $xfRoot.params1.params2.relief.relief1 {top fill expand} \
  1036.                 $xfRoot.params1.params2.relief.relief2 {top fill expand}
  1037.   } {
  1038.     pack append $xfRoot.params1.params2.relief \
  1039.                 $xfRoot.params1.params2.relief.label1 {left} \
  1040.                 $xfRoot.params1.params2.relief.relief1 {top fill expand}
  1041.   }
  1042.   pack append $xfRoot.params1.params2 \
  1043.               $xfRoot.params1.params2.relief {top fillx pady 6}
  1044. }
  1045.  
  1046. ##########
  1047. # Procedure: XFElementSave
  1048. # Description: save current parameters for widget
  1049. # Arguments: xfW - the widget we configure
  1050. #            xfClass - the class we configure
  1051. #            xfResources - the parameters to save
  1052. # Returns: none
  1053. # Sideeffects: none
  1054. ##########
  1055. proc XFElementSave {xfW xfClass xfResources} {
  1056.   global xfMisc
  1057.  
  1058.   set xfMisc($xfClass,saveValue) ""
  1059.   foreach xfCounter $xfResources {
  1060.     set xfValue [lindex [$xfW configure -$xfCounter] 4]
  1061.     if {"$xfCounter" == "state"} {
  1062.       if {"$xfValue" == "active"} {
  1063.         set xfValue normal
  1064.       }
  1065.     }
  1066.     if {"$xfCounter" == "command" && "$xfClass" == "Scale" &&
  1067.         "$xfValue" == ""} {
  1068.       continue
  1069.     }
  1070.     if {"$xfCounter" == "command" && "$xfClass" == "Scrollbar" &&
  1071.         "$xfValue" == ""} {
  1072.       continue
  1073.     }
  1074.     if {"$xfCounter" == "scrollregion" && "$xfClass" == "Canvas" &&
  1075.         "$xfValue" == ""} {
  1076.       continue
  1077.     }
  1078.     if {"$xfCounter" == "file" && "$xfClass" == "TkEmacs" &&
  1079.         "$xfValue" == ""} {
  1080.       continue
  1081.     }
  1082.     if {"$xfCounter" == "scrollcommand" ||
  1083.         "$xfCounter" == "xscrollcommand" ||
  1084.         "$xfCounter" == "yscrollcommand"} {
  1085.       if {"$xfValue" == ""} {
  1086.         continue
  1087.       }
  1088.     }
  1089.     set xfTmpValue $xfCounter
  1090.     lappend xfTmpValue $xfValue
  1091.     lappend xfMisc($xfClass,saveValue) $xfTmpValue
  1092.   }
  1093. }
  1094.  
  1095. ##########
  1096. # Procedure: XFElementScale
  1097. # Description: build scale frame
  1098. # Arguments: xfW - the widget we configure
  1099. #            xfRoot - the root name
  1100. #            xfType - add or config
  1101. #            xfClass - the class we configure
  1102. #            xfName - the name of the widget
  1103. #            xfResource - the resource
  1104. #            xfResClass - the resource class
  1105. #            xfLabel1 - the left label
  1106. #            xfLabel2 - the scale label
  1107. #            xfTo - the to value
  1108. #            xfFunction - the function that sets the values
  1109. # Returns: none
  1110. # Sideeffects: none
  1111. ##########
  1112. proc XFElementScale {xfW xfRoot xfType xfClass xfName xfResource \
  1113.                      xfResClass xfLabel1 xfLabel2 xfTo xfFunction} {
  1114.   global xfStatus
  1115.  
  1116.   if {"$xfType" == "config" || "$xfW" != "."} {
  1117.     XFTmpltScale $xfRoot.params1.params2 $xfName \
  1118.       "$xfLabel1:" $xfLabel2 $xfTo \
  1119.         [lindex [$xfW configure -[string tolower $xfResource]] 4]
  1120.   } {
  1121.     XFTmpltScale $xfRoot.params1.params2 $xfName \
  1122.       "$xfLabel1:" $xfLabel2 $xfTo
  1123.   }
  1124.  
  1125.   XFMiscSetResource $xfRoot.params1.params2.$xfName.$xfName \
  1126.     relief sunken
  1127.   XFMiscSetResource $xfRoot.params1.params2.$xfName.label1 \
  1128.     width $xfStatus(elementWidth)
  1129.   XFMiscSetResource $xfRoot.params1.params2.$xfName.label1 \
  1130.     anchor e
  1131.   XFMiscSetResource $xfRoot.params1.params2.$xfName.label1 \
  1132.     relief flat
  1133.   if {"$xfType" != "add"} {
  1134.     XFMiscSetResource $xfRoot.params1.params2.$xfName.$xfName \
  1135.       command "$xfFunction $xfW 0 $xfClass"
  1136.   }
  1137.  
  1138.   # packing of subwidgets
  1139.   pack append $xfRoot.params1.params2 \
  1140.               $xfRoot.params1.params2.$xfName {top fillx pady 6}
  1141. }
  1142.  
  1143. ##########
  1144. # Procedure: XFElementScaleDouble
  1145. # Description: build double scale frame
  1146. # Arguments: xfW - the widget we configure
  1147. #            xfRoot - the root name
  1148. #            xfType - add or config
  1149. #            xfClass - the class we configure
  1150. #            xfName - the name of the widget
  1151. #            xfLabel1 - the left label
  1152. #            xfLabel2 - the scale label
  1153. #            xfLabel3 - the scale label
  1154. #            xfTo1 - the to value
  1155. #            xfTo2 - the to value
  1156. #            {xfCheckVar} - variable for label (as checkbutton)
  1157. # Returns: none
  1158. # Sideeffects: none
  1159. ##########
  1160. proc XFElementScaleDouble {xfW xfRoot xfType xfClass xfName xfLabel1 \
  1161.                            xfLabel2 xfLabel3 xfTo1 xfTo2 {xfCheckVar ""}} {
  1162.   global xfStatus
  1163.  
  1164.   XFTmpltScaleDouble $xfRoot.params1.params2 $xfName \
  1165.     "$xfLabel1:" $xfLabel2 $xfLabel3 $xfTo1 $xfTo2 0 0 $xfCheckVar
  1166.  
  1167.   XFMiscSetResource $xfRoot.params1.params2.$xfName.${xfName}1.${xfName}1 \
  1168.     relief sunken
  1169.   XFMiscSetResource $xfRoot.params1.params2.$xfName.${xfName}2.${xfName}2 \
  1170.     relief sunken
  1171.   XFMiscSetResource $xfRoot.params1.params2.$xfName.label1 \
  1172.     width [expr $xfStatus(elementWidth)-3]
  1173.   XFMiscSetResource $xfRoot.params1.params2.$xfName.label1 \
  1174.     anchor e
  1175.   XFMiscSetResource $xfRoot.params1.params2.$xfName.label1 \
  1176.     relief flat
  1177.  
  1178.   # packing of subwidgets
  1179.   pack append $xfRoot.params1.params2 \
  1180.               $xfRoot.params1.params2.$xfName {top fillx pady 6}
  1181. }
  1182.  
  1183. ##########
  1184. # Procedure: XFElementSize
  1185. # Description: build width and height frame
  1186. # Arguments: xfW - the widget we configure
  1187. #            xfRoot - the root name
  1188. #            xfType - add or config
  1189. #            xfClass - the class we configure
  1190. #            xfFunction - the function that sets the values
  1191. # Returns: none
  1192. # Sideeffects: none
  1193. ##########
  1194. proc XFElementSize {xfW xfRoot xfType xfClass xfFunction} {
  1195.   global xfStatus
  1196.  
  1197.   XFTmpltScaleDouble $xfRoot.params1.params2 size "Size:" \
  1198.     "Width" "Height" 1000 1000
  1199.   $xfRoot.params1.params2.size.size1.size1 set \
  1200.     [lindex [$xfW configure -width] 4]
  1201.   $xfRoot.params1.params2.size.size2.size2 set \
  1202.     [lindex [$xfW configure -height] 4]
  1203.  
  1204.   XFMiscSetResource $xfRoot.params1.params2.size.size1.size1 \
  1205.     relief sunken
  1206.   XFMiscSetResource $xfRoot.params1.params2.size.size2.size2 \
  1207.     relief sunken
  1208.   XFMiscSetResource $xfRoot.params1.params2.size.label1 \
  1209.     width $xfStatus(elementWidth)
  1210.   XFMiscSetResource $xfRoot.params1.params2.size.label1 \
  1211.     anchor e
  1212.   XFMiscSetResource $xfRoot.params1.params2.size.label1 \
  1213.     relief flat
  1214.   if {"$xfType" != "add"} {
  1215.     XFMiscSetResource $xfRoot.params1.params2.size.size1.size1 \
  1216.       command "$xfFunction $xfW 0 $xfClass"
  1217.     XFMiscSetResource $xfRoot.params1.params2.size.size2.size2 \
  1218.       command "$xfFunction $xfW 0 $xfClass"
  1219.   }
  1220.  
  1221.   # packing of subwidgets
  1222.   pack append $xfRoot.params1.params2 \
  1223.               $xfRoot.params1.params2.size {top fillx pady 6}
  1224. }
  1225.  
  1226. ##########
  1227. # Procedure: XFElementState
  1228. # Description: build state frame
  1229. # Arguments: xfW - the widget we configure
  1230. #            xfRoot - the root name
  1231. #            xfType - add or config
  1232. #            xfClass - the class we configure
  1233. #            xfFunction - the function that sets the values
  1234. # Returns: none
  1235. # Sideeffects: none
  1236. ##########
  1237. proc XFElementState {xfW xfRoot xfType xfClass xfFunction} {
  1238.   global xfMisc
  1239.   global xfStatus
  1240.  
  1241.   set xfMisc(state) normal
  1242.  
  1243.   XFTmpltFrame $xfRoot.params1.params2.state 0
  1244.  
  1245.   label $xfRoot.params1.params2.state.label1 \
  1246.     -anchor e \
  1247.     -width $xfStatus(elementWidth) \
  1248.     -text "State:"
  1249.  
  1250.   radiobutton $xfRoot.params1.params2.state.normal \
  1251.     -text "Normal" \
  1252.     -variable xfMisc(state)
  1253.  
  1254.   radiobutton $xfRoot.params1.params2.state.active \
  1255.     -text "Active" \
  1256.     -variable xfMisc(state)
  1257.  
  1258.   radiobutton $xfRoot.params1.params2.state.disabled \
  1259.     -text "Disabled" \
  1260.     -variable xfMisc(state)
  1261.  
  1262.   if {"$xfType" == "add"} {
  1263.     $xfRoot.params1.params2.state.normal select
  1264.   } {
  1265.     case [lindex [$xfW configure -state] 4] in {
  1266.       {disabled} {
  1267.         $xfRoot.params1.params2.state.disabled select
  1268.       }
  1269.       {default} {
  1270.         $xfRoot.params1.params2.state.normal select
  1271.       }
  1272.     }
  1273.     $xfRoot.params1.params2.state.normal configure \
  1274.       -command "$xfFunction $xfW 0 $xfClass"
  1275.  
  1276.     $xfRoot.params1.params2.state.active configure \
  1277.       -command "$xfFunction $xfW 0 $xfClass"
  1278.  
  1279.     $xfRoot.params1.params2.state.disabled configure \
  1280.       -command "$xfFunction $xfW 0 $xfClass"
  1281.   }
  1282.  
  1283.   # packing of subwidgets
  1284.   pack append $xfRoot.params1.params2.state \
  1285.               $xfRoot.params1.params2.state.label1 {left} \
  1286.               $xfRoot.params1.params2.state.normal {left fillx expand} \
  1287.               $xfRoot.params1.params2.state.active {left fillx expand} \
  1288.               $xfRoot.params1.params2.state.disabled {left fillx expand}
  1289.   pack append $xfRoot.params1.params2 \
  1290.               $xfRoot.params1.params2.state {top fillx pady 6}
  1291. }
  1292.  
  1293. ##########
  1294. # Procedure: XFElementText
  1295. # Description: build text frame
  1296. # Arguments: xfW - the widget we configure
  1297. #            xfRoot - the root name
  1298. #            xfType - add or config
  1299. #            xfClass - the class we configure
  1300. #            xfName - the name of the widget
  1301. #            xfResource - the resource
  1302. #            xfResClass - the resource class
  1303. #            xfLabel - the label
  1304. #            xfFunction - the function that sets the values
  1305. #            xfValue - the default contents
  1306. # Returns: none
  1307. # Sideeffects: none
  1308. ##########
  1309. proc XFElementText {xfW xfRoot xfType xfClass xfName xfResource xfResClass \
  1310.                     xfLabel xfFunction {xfValue ""}} {
  1311.  
  1312.   if {"$xfType" == "add"} {
  1313.     if {"$xfValue]" != ""} {
  1314.       XFTmpltLabledEntry $xfRoot.params1.params2 $xfName "$xfLabel:" \
  1315.         $xfValue
  1316.     } {
  1317.       XFTmpltLabledEntry $xfRoot.params1.params2 $xfName "$xfLabel:" \
  1318.         [lindex [$xfW configure -[string tolower $xfResource]] 4]
  1319.     }
  1320.   } {
  1321.     XFTmpltLabledEntry $xfRoot.params1.params2 $xfName "$xfLabel:" \
  1322.       [lindex [$xfW configure -[string tolower $xfResource]] 4]
  1323.   }
  1324.  
  1325.   XFMiscInitElement $xfRoot $xfName
  1326.  
  1327.   if {"$xfType" != "add"} {
  1328.     bind $xfRoot.params1.params2.$xfName.$xfName <Return> \
  1329.       "$xfFunction $xfW 0 $xfClass"
  1330.   }
  1331.  
  1332.   # packing of subwidgets
  1333.   pack append $xfRoot.params1.params2 \
  1334.               $xfRoot.params1.params2.$xfName {top fillx pady 6}
  1335. }
  1336.  
  1337. ##########
  1338. # Procedure: XFElementTextVariable
  1339. # Description: build text variable frame
  1340. # Arguments: xfW - the widget we configure
  1341. #            xfRoot - the root name
  1342. #            xfType - add or config
  1343. #            xfClass - the class we configure
  1344. #            xfFunction - the function that sets the values
  1345. # Returns: none
  1346. # Sideeffects: none
  1347. ##########
  1348. proc XFElementTextVariable {xfW xfRoot xfType xfClass xfFunction} {
  1349.   global xfBind
  1350.  
  1351.   XFTmpltLabledEntry $xfRoot.params1.params2 textvar "Text variable:" \
  1352.     [lindex [$xfW configure -textvariable] 4]
  1353.  
  1354.   XFMiscInitElement $xfRoot textvar
  1355.  
  1356.   # bindings
  1357.   bind $xfRoot.params1.params2.textvar.textvar $xfBind(configure) \
  1358.     "XFInfoGlobals $xfRoot.params1.params2.textvar.textvar"
  1359.   if {"$xfType" != "add"} {
  1360.     bind $xfRoot.params1.params2.textvar.textvar <Return> \
  1361.       "$xfFunction $xfW 0 $xfClass"
  1362.   }
  1363.  
  1364.   # packing of subwidgets
  1365.   pack append $xfRoot.params1.params2 \
  1366.               $xfRoot.params1.params2.textvar {top fillx pady 6}
  1367. }
  1368.  
  1369. ##########
  1370. # Procedure: XFElementVariable
  1371. # Description: build variable frame
  1372. # Arguments: xfW - the widget we configure
  1373. #            xfRoot - the root name
  1374. #            xfType - add or config
  1375. #            xfClass - the class we configure
  1376. #            xfFunction - the function that sets the values
  1377. # Returns: none
  1378. # Sideeffects: none
  1379. ##########
  1380. proc XFElementVariable {xfW xfRoot xfType xfClass xfFunction} {
  1381.   global xfBind
  1382.  
  1383.   XFTmpltLabledEntry $xfRoot.params1.params2 variable "Variable:" \
  1384.     [lindex [$xfW configure -variable] 4]
  1385.  
  1386.   XFMiscInitElement $xfRoot variable
  1387.  
  1388.   # bindings
  1389.   bind $xfRoot.params1.params2.variable.variable $xfBind(configure) \
  1390.     "XFInfoGlobals $xfRoot.params1.params2.variable.variable"
  1391.   if {"$xfType" != "add"} {
  1392.     bind $xfRoot.params1.params2.variable.variable <Return> \
  1393.       "$xfFunction $xfW 0 $xfClass"
  1394.   }
  1395.  
  1396.   # packing of subwidgets
  1397.   pack append $xfRoot.params1.params2 \
  1398.               $xfRoot.params1.params2.variable {top fillx pady 6}
  1399. }
  1400.  
  1401. # eof
  1402.  
  1403.